Fix namespace
Different refactorings and fixes