moved some code out of crustcool.cc