refactoring scatt fun