Finish cookie authentication. Add logging for sorting, promoting, and demoting.