Refactored devmanager to be JavaScript standar complient and to avoid poluting global scope.