Move code from Gaia