Development restart commit

Few refactorings and bug fixes