http://mbed.org/users/shimniok/code/SimpleFilter/#70348515ed2f