added code comments, needs review