Added ability to specify input format