refactor to use lists function