added more in-code comments