function code moved into _call method