finished clientside refactor