debugged first two special cases