how to construct partial functions
some tweaks