code formating and  correcting beginOfWeek