clean up the host code