added savepoint support and testing mode