minor twist of z_score function