Added an optional callback function to titlecase