move appendToken code to where it will run refs #200