Moved some code to util functions
Moved TSV-RPC code to separate package