partway through refactor