Cleaned up format handling.