Add date functions and a small bit of code formatting