code cleanup, and adding a written analysis.