Complete overhaul to speed up adn match new database structure