Refactor signal handler to not use a class