Improved slug generation algorithm