moving code out of payments block