Streamlined approach for #99

Keep the modal's index within itself and define a global index which increments onShow and decrements onDestroy