Added signal processing code