Refactor src/ modules and build + packaging process

I like `import` and `export` statements to be at the top of my modules.