Comments and more improvement.

more logic to not do extra processing. A lot more comments to explain whats happening.