refactored to have default capacity