refactoring vars in map controller