Adding Rollback support(first try) + refactoring