Added synchronized blocks.
Merge pull request #59 from iuj/master

Added synchronized blocks.