Improve module handling