Make use of variable

Rather than taking an index of a list.