added synchronized keyword