Added size and total count of query to results

Also moved database handling into data.clj, where it should be