Added comments to functions. Fixed some login mistakes.