Changed everything to allow function handles. Added quadFunc, which is generic function handle.