add discovery support (not finished yet)