added source code for synchronized use