Added two unit tests, simplified code by removing unnecessary else statements