added ability to specify input format