Memory leak prevention

Unsetting some vars to prevent memory leak as read on stackoverflow (the bible?). It`s late and I`m tired.