replaced arrays to ArrayList
completely replaced arrays with ArrayLists