major refactoring, new features, bug fixes