Improved login, added deadlines. Moved data base connection to a separate file.