Refactor app and sensor module inizialization and their tests