Factor out unnecessary modules and code