[ADD] Added callback functions, improvements for gateway discovery functions