Add and use usage_exit() function.
Add log() function.
Add some logging statements for debugging.
Add omero_query() function, use shorter variable name.