First functional version of the seriation (at least it seems like that so far)