cleanup, simplify, optimize