Adds getDocosade routine, abstracts date calc code a bit