Modified the files to support multiple clients

The implmentation is very inefficient