Increment accound id instead of always being 1.

Wrote queryAccounts db function.
Wrote firstAvailableId helper function