Added better file handling support to api