the code looks even worse now, but the logik should now work as intended. I was able to reproduce "Schaltbild 30" from the "Logikus Handbuch" on page 72