refactored text rendering.