Lava search

Note that the first commit in here has been removed.

Fixing bugs, mostly names of variables in the database. Reusing constants that I've defined, putting apostrophes in SQL queries.