Added checks to make sure that a function is being called with the correct number of arguments