move display fun to correct loop