simplified code a bit
improved date handling by using joda-time