Adding support for more data formats and fixing a bug