tidy up token construction, making a public function available to other modules