Changed ArrayDeque to LinkedList because ArrayDeque does not support null entries