ddply code cleanup and add comments