script adapted for orientation constraints