minor housekeeping (added static where appropriate, removed extern for nonglobals)