Added logic to the hook so that it sets up the first gear as the master.