Updated  a number of files

Neatened up the code.
Added more comments.
Added image search api.