added a ton of comments, fixed up testers, optimized some code