We need to refactor this.