Fixed R calc again, updated gapclose a bit