better performance due to rare commits to database
added querying sqltree. Very slow