added calendar, remove duplicate code