added a lot more comments (should probably add more)