refactored split_to_width and text justification