modular build code optimization + some extras