rewrote gather procedure to now correclty work