more commenting and fixed a bug