Clean up misc code