new code that works! See Yan GitHub is your friend