refactor methods and map