Added error handling, callbacks, unit tests for module