Overhauled database

Eliminated test mode for now, now properly checks exists and empty is
multiple places, the header will have new by second entries everytime we
calibrate (still need to integrate this with alex) increased overall
code quality and added additional functionality.