update with code refactoring