Added forest recognition functionality and added tests for it.
Slightly modified the is_tree() function.