serverside refactor