Refactored composite code