Changed the login system, fixed several bugs