Combined persist and db functions, also bugs and what have ya