Finish major refactor