totally rewrite the view function, much more readable now