Added switch statement into signal hanlder