Improved my ticket function