Use regen_metadata() after before ending the current recursion step. Remove rotations therefor
After adding a node to the tree, we must rebalance the appropriate subtree
Moved add() code to avl_add()

As the code is not that complex anymore, the add() function body was
moved to  the avl_add() function with this commit.
Added missing data insertion
Remove element_with_hash() helper function

The functionality of element_with_hash() is provided by avl_find(), so
use this function instead.