Much saner way to write this.