towards a more generic solution