major refactor, probably should be new branch but did not want to create one after doing the changes incase they got overwritten