initial comments

added a bunch of comments and cleaned up a bit of logic I was worried about