finish overall refactor