fixed compiler warnings, added consistency, added standard error codes