Added comments and did some functions