```'offset' - 1``` looks wrong, add some tests to double check such things maybe :)