Move the code into modules for easier use and structure