Tighter tests, better fix for condition when new item will sort to the end

Signed-off-by: Martin Koistinen <mkoistinen@gmail.com>