working out gaiting code