Slight rearrangement and fixed problem with faulty endpoints.