code copy from checkbook