Updated diagonal logic