major update & refactoring