Code improvement & performance (Part I)

And also fixes recently problems with Travis.ci