Minor tweak

Removed _error global, replaced with function return codes