Updated with comments and minor write correction