More efficient text drawing, code cleanup