cleaned up demurrage function

cleaned up demurrage function