new features (expiration date and beginning) and some refactoring