improving the views code