corrected logical code misstakes