works ok on given sample