Changed List to ArrayList to avoid UnsupportedOperationException.