Made some improvments on root checking