It seems like there should be a better way of doing this.