better date support and cleaner code