Refactors token send function