removed __inline's
Added error handlers
Added error handlers