Refactoring: change methods to synchronized