Humongous refactorization PR for Jannovar

This is my work over the last few weeks. I propose that development should continue in smaller chunks/feature branches from here.