starts to move scatter code out into separate js