Cleanup code. Add comments.