[refactoring] Removed duplicate code.