make implementation more generic