new algorithm for handling the data from the db.
add support for LOD