a bunch of helpful functions