move all code to lib
__FILE__ == -bash trick; tighten Interrupt handling