Added rudimentary signal handlers. Still needs some work.