changed a lot to read dates correctly