switched from linkedlist to arraylist
Faster implementation of ArrayList.