a proper subfunction version in which all currently existing tests pass