Lots of changes, added some SQL queries for logging in