adds sigterm handling, stored procedures