Implemented reset function + refactored API