Added a sorting function for all the classes, fixed the login/logout function aswell