refactor of changing views