major refactoring, leaving no stone unturned ;-)