whole mess of helper one-off functions