re-factored texting code