Re-organised codebase to be more idiomatic.