Tidied up callback handling (code layout change).