factored out list creation function