Added code comments. Cleaned up code.