Added support for hidden apps (bug 1019249, 1019251)

I started to do this then decided to leave it b/c I didn't want to cause more change than necessary. But now you both commented I can go ahead. I agree, mat, that code is much better.