Modify expandArrayList func and finish trimArrayList func