re-positioned helper functions