Further editting of ctd_functions.py