Began to implement some useful database querys