Added slug logic. Credits to Steven for the _generate_slug() function.