Removed old unused code, adjusted login a bit