Use a not-so-ugly way to replace module name
Tidy up a bit