There must be a nicer way to do this but until we come up with something else merge this!