Refactored and added text support