putting listing into separaate function