Refactor using format