Done a lot of refactoring work