Added caching to the datatype lookup to save database hits