Converted user API to better error handling.