A lot of bugfixes & style improvements toward v1