Improve format handling