miscellaneous helper functions