Refactorings

Merge refactorings branch