Refactor creation of table in main view
Refactor main view