Refactored #average