Content provider added
Several refactoring in order to make it easier to understand