Few fixes/tweaks for the Cache app, but still a bit to go

Hey man,

Here are a few things I did to tweak the application. There's actually a few more things to do to make it more secure, but I figured I had already changed a lot of things already :)
Another small "syntax" thing -- if you are doing a simple if statement checking some sort validity, I normally see it come at the end, unless there is multiple conditions, an else, etc.