Battle against memory leaks + bonus

Version 0.3.1 in preparation.
* Solve 80% of the leaks detected
* Minor fix on the shouldAutoRotate method