Changed data structure to record all trials. Inclding DB for testing.