Move more code inside synchronized