Tidied and commented