using dicts
refactored to add capacity feature