a proper subfuction version in which all currently existing tests pass