refactor sources gadgets connection