Improve module removal functionality