code refactoring for slug management