There is probably a better way to do this...