Fix dependency versions
some lovely refactors
KAPOW! Lots of duplication gone