Move Julian day calculation into new function.