re-arrange a bit and establish pattern for repl