Added comments for functions. Added loginCheck