Refactor of get bounded box