Tidying up how we interact with the DB.

Lengthed commands in connection to DB. Should save some time and clear
up later on.