Modularization

Started turning important parts into modules so I can use them elsewhere