finally a working subscriber back end but ugly code