Review fixes and removal of unused code.
Use AMD's module name guessing algorithm.