Added transaction stuff to database

Make sure to clear data before trying to use it.