Made a synchronized method.