General cleanup and simplification