more generic approach