Bugfixes and more reliable expiration policy

Due to a slight logic error, expirations were not always being set.  This has been fixed!