Changed payment rule to be derived from prior and scaled.
Added more testing code.