w.i.p. extracting reusable code from spike