Added format detection