relocated some direction code