Much more stable version, cleaned up code, can now do events more than 12 hours before and after