big refactor.