Fixed a better implementation of the database