Fixed bug 3912
Fix typos
Code cleanup
Add unset() statement to help for future refactoring