Major refactor of just about everything