Refactor and fix inventory limit checking.