refactor max capacity code
working max capacity