Rewrote HardListener to be more robust and avoids the use of locks