some boilerplate code changed, disconnect db on sigint implemented