come up with client side control flow
add db dir
fix vars passed to templates
super messy server side control flow