updated code comments and minor editting