Use named function literals, move export statements above function declaration

- I prefer `function name() {}` over `var name = function() {}`
- `module.exports = name; function name() {}` works. It's nice to keep the export declaration next to the function declaration. Just personal taste though...