Moved the signal code to a separate class.