major refactoring and API redesign