Move object conversion functions from index to fuctions
Move exit() from top of index to bottom of ajax.

It just doesn't feel right and seems confusing, I think.
Added a load() type of function using file_get_contents instead of include
Use load_file instead of concatting file_get_contents