added some comments etc