refactor display functions