Tidied up the slug function.
More tidying up. Reworked slug generation.