Merging some code from apiv2 to master (simlarity server utilities)