pieced out the helper functions