updating finding of position and removing the extra new lines