Rearranging and taking out code from copy made earlier