New gallery views stuff added, some DB tweaks, and bits of code tidied up.