fixed bugm, added more comments