cleanup code for computing handler