some helpful functions