wrote a couple helper functions