Added ability to serialize functions.