Added some basic commenting, still have some questions about some functions.