refactored format and apply