Merged Rittie's file, added signal handler