changed KSequence to use persistent data structure again