Make the stagings script a little more clever