Merged the two versions