Improve mapping for more functions.

I moved the module definition to its own file because I think it's more convenient.