Refactoring : separate backend and html generator