resolves #19 : implemented generic solution