Moving to database dependence

Change server side scripts to allow for less queries.