moved login to main page, refactored a little, fixed login error