Make functions static and remove an unused one; simplify a little more code.