Reimplement state handling in rpm_by functions