Expanded markActive line, added code comments