modified lock() and unlock() to static methods.