Re-wrote the module

Mostly the rework is about better organization, dropping code where it
isn't needed, leveraging fundemental data structures, and still
familiarizing myself with the packages modules and functionality.

This still needs some more documetations, some testing, but I think it
is going in the right direction.
Quieted some warnings from the linter