Use justifyRight instead of custom function
Define applyTextFunction