added a more generic impl