Code cleanup
First cut at final write up