commenting and refining code