Updated Code for the first revision of the paper