Changed method to handle day transition