Added typechecking for member function calls. (Now tree.cpp test passes)
Slight code cleanup