Third Commit
used isEmpty instead of length == 0