fixing a bug and adding more explanation