Remove duplicated code
Update thread_safe gem