split out optimizations into separate modules