Refactor openContainer method