Add initial unittests

Add except KeyboardInterrupt to exit gracefully