More elegant locking structure. More robust PING parsing.