Add global signals and refactor signal callback.