Added print list method to avoid code duplication