Class that calculates final database