Finalized all of the dirty work with most of the comments. The code should be readable now.