Implement external composition function to handle multiple variable dependencies