cleaned version and some typos