refactor out io server side, add set username