Improved thread safety
Added a comment to the javadocs here