simplify and cleanup temporaries