display function added - found some bugs