We should add some tests for this.