Port master_tops code over from develop