Cleaned up code and removed dependencies.
Added custom log / error callbacks.