fixed login routine
clean up js code
Small changes.