persistence layer fixed, using exception factory, TODOs added