finished off helper functions