rebase from bekk/retire.js