Clean up imports and flag variables