Added extensive code comments/documentation