refactor Map and inventory, improve JavaDoc