Clean more old code and simplify a bit