add synchronized keyword but unsure if required