Made output better. But still anomalies in output