Added toString() and getName() interfaces, but not working.
DO NOT USE THIS COMMIT!
Fixed the toString() problem.
Removed an extra lock for performance improvement.
Misc other fixes.