changed where transition happens in display function to fix text overflow