working version with list data structure pre testing