Tidy up, nicer handling of missing resource
Cookie encryption support