added plugin, and cleaned up client + server code