Refactored median exercise