Fixed validateFunction, added OPTIONAL argument type, refactored validateObject to throw errors non-object types (number, string, etc.)