Removed not needed parameter.
Added debug log.
Added thread safety.
Added thread safety.