Code cleaned up for submission.