Few refactorings and example update