v2: reorganized & cleaned up