refactored 'average' method
merge resolution