Just a little algorithm