Try to factor the text drawing in a function