added partial implementation for signal handling, compiled but not tested