Renamed a few struct members, and added a signal-wait thread. Server now
exits cleanly when receiving a SIGTERM.