#3 refactor rollback code