Fixed format detection and added new formats