Completed code for detecting gunshots