This commit refactors all func value handling into a new file, which makes it easier to comprehend it and extend it later.