this should get broken out into some kind of helper method