* Minor code fixes.
* Changed code to follow some "good practices" (avoiding memory leaks by removing references).