Reimplemented length logic.