Revert "Revert "Changes to make the code work using petsc 3.4 and Ubuntu 14.04. We keep backwards compatibility.""

This reverts commit ae1a6975865c7ffd048ad5cd545735d15b7ec4a5.

Preparing for my next commit. Code does NOT compiles