Fixed missing cleanup
Moved things around