1. Used ReadWrite lock instead of synchronization methods for better
concurrency. 
2. Minor refactor of the code.