changed vector arrays to maps
refactoring to move device to methods