moving imports to the top; adding KeyboardInterrupt handling
adding small file check