Increased code readablity.

Some code clean ups and added describing comments.