more commenting and error fixing