Moved login system to api, moved authentication to class