refactoring fmt to method