Compiles and removes modules correctly.