Cleaned Code. Change some variables names to make it easier to read. Added some more java doc.