Extended and refactored ci scripts