added helpers and started CPS style work