Added documentation to function_prototype
And fixed a few design bugs that I came across regarding the function-related classes and methods.