Mark local defs as private.
Slightly safer if strings or functions passed in
Fix redirect & add logging.