refactored prepareBundle.sh