minor adjustments on the code