Improved the listener to check for completed circuits