refactor map persistance into separate module