Functional implementation of all sorts