refactor views and scripts