Start to implement proper date encoding