Updated tesi and fixed some minor bugs