Reformatted and partly re-written