Updated solution with new global class