Modified login code - unfinished