re-organize set view code