new version - does not consider topology