midway through refactor