Security and other changes

* Made $valid require TRUE
* Reversed the array output so the newest items are first.
* Other small changes