minor refactoring to pulse detector