Refactor code

Returns correct results on first invocation from omnicomplcache
but then seemingly gets stuck while waiting for data from  socket