Working on breaking up the functions as best as possible where possible
Removed unused code