refactor tests, fix iteration (for negative offset)