improve view code