Fixes #16: add lifetime of access code; refactoring of access code management.