finalize initial refactoring