There has to be a simpler way to do this...