added code for last day