Moved database stuff into a class for easier use, then created a types/type page