modifying index html layout and restructure code for code reuse