Add comments

Comments are added for the file and each function to better describe it's purpose