Move token generation into module