edited for typos and minor syntax errors