very messy implementation; somehow gets stuck
...