Bugfixes & refactor. v6