Added logic to handle  multiple aces