Large refactor, moved some classes to other packages and pulled out some inner classes