Main spec autodetection, apply format fixes