Better shutdown handling. kinda.