Restructure into more packages to make code easier to understand/test