Removed unused code.
Much tweaking.
Added tests.
Changed the default query.