fixing bugs and adding other comments