there has to be a better way to do the above.