lots of changes to login and main file