Refactor server