Refactored similarity indexing server so now it keeps always running but can clear unneeded memory