Modularize the Code

This appropriately makes the code modular as I originally intended. Should make things a bit cleaner.