Seeing the code repetition, I think these should be implemented in the Function class. This can be done in a separate PR.