Move signal handling library functions to separate file