Factored out a couple of unused / duplicate functions.