lots of clean up for user-mode