refactored out persistence layer to seperate concerns