replaced custom queue with Data.Sequence