reorganized the views code