Merge pull request #780 from andrerod/compat

Moving reusing pieces of code
Merge pull request #781 from andrerod/compat

remove file