move code to stop receiver in a separate method