Added custom functions support thanks to https://bbs.archlinux.org/viewtopic.php?pid=1407087#p1407087