more functional code examples thaks to /u/makis