added some comments, still working on adding comments. Also, fixed some new bugs and optimized the code a bit