added comments and more organization to code. I think its much more readable now and references sections/equations in lindstrom paper.