major refactoring to v2