all the following logic is unneeded/wrong, see my comment above