start of refactor