fixed all edge cases and added calendar options