Remove redundant code.
Use consistent modname calculation.