Extraced slug generation code to a common place