add a temporary --test flag for allowing regular main execution. also, correctly handle non-existent files