Fix query preparation & clean up line breaks somewhat

We used 'prepared' in several places instead of the correct 'prepare', which
means that our queries were not prepared at all.

Also break some over-long lines and detabify index.js.