refactor signal handle