Standardize callbacks and cleanup code.
Updated err variable instead of null.
Merge pull request #24 from hybridgroup/standardize-callback

Standardize callback and cleanup code