Add type notation
Improve testing, expiration calculation