Built a mechanism for waiting for message replies from pi