Deploy script improvements by @BFTrick.