refactored api, added users endpoint