Added copulate, fixed read and write to use json