Modified logic of calendar layout.