Updated class to support multiple db