master implementation