Fixed views

The structure in $result was getting weird, so I used an alternative.