implemented a list print function