i can't believe i hadn't opensourced this.