Format autodetection bugfix.
Optimize some imports.