modularize code of views. Extra repeated codes to html/component