Fixed #805, first use of the functional library