Added lots of comments, debuging things, and fixed variable names. Added this-> prefix to most class variables