Switched from LinkedList to ArrayList to reduce overhead