Changed compile-clean to more sophisticated implementation