Better error handling
Prevent processing stale messages
More precise comparison