Update view
Refactor main script