refactoring for a better display