refine view code