Added new formats, improved code