Added a bit of code to check whether or not there is only one root