cleanup and simplify