added some comments etc.