updated file retrival, we now use json_encode instead of doing it ourselves (This fixes any issues with character encodings)