there must be a better way to do this