Use #empty? method instead of #count == 0
Merge pull request #24 from dv/patch-1

Use counter cache when checking #leaf? Refactor tests and fix preloading test.