Minor refactor with manipulateQueryBuilder. Makes for less repeated code.

There are some minor bugs, but editEntry is almost complete.