Changed methods to synchronized