Refactored lots of stuff and added the new files