added synchronized blocks