Use strict and warnings.
Should be using AE::now instead of time() directly
Some fixes from strict/warnings
Well that's embarrassing.

Yes, it's changed.
Another strict fix
Variable typo