Code tidied and tightened.