optimization (code refactoring)