more commenting added throughout