this is messy, there's got to be a nicer way to do this