refactored database stuff and finished protocol tester