Added normalisation and normalised generator. Split generator out into separate function.