Pull short id generation into separate class

This refactor pull short id generation out into a dedicated class. This reduces duplication and centralizes control of short id generation, so that if the method changes, it only has to change in the code once (theoretically).