finish major refactor