Turned database into class