refactored ci script