started refactor to rebuild outside of server