cleanup and first simplification