Cleanup

Some cleanup done while working through the code to understand what it does.