replace arrays with lists for performance