updated, with comments