changed algorithm to reduce l by one if we have hit a zero row, this is not in the reference I used (Cohen) but makes sense to me and causes several cases that do not otherwise work as intended to do so