Several improvements and refactorings Iteration 7