(if it was a class this could be a class-level function, which is nice)