Added ticket generating function