rejigged code and added sections