MODIFIED: added some comments