Ajax nodes tweaks

Performance tweaks when ajax-loading to reduce the number of DB queries Nodes#tree call.
Line is too long. [105/80]