Cleanup, better names, and add comments