Moved date utils to lib
Separated constants from working code
Added diagnostic output