Major update/refactoring