Thread safe implementation added