Basically modularizated the code and renamed some things
Tried to fix some merge conflicts