improved staging script