Corrected a minor bug
Some minor refinements