whoops, I never finished refactoring that function