using proxy class to guarantee thread safety