Cleanup, only keep relevant code