Added code for sound detection