Big refactor and start to put it all together