Code cleanup [fixes #906]

I'm using the inspections in IDEA to make sense of what can be removed or not

- [x] remove unused assigns
- [ ] remove unused declarations