updated code with display functions