A small nitpick while you are refactoring 

I removed unnecessary conversion to list.