modified katec.sh