Refactor map loader to class