added comments describing functions