Updated source code from group's Google Document
Added lots of comments!