view code refactoring