clean up

improved login logic