Probably a better way of doing this.