Some cleanup and outlining