Use of pronoun for objects in the preceding sentence [duplicate]

Welcome to the site!

The back-reference of personal pronouns, such as it, is usually free, but it depends on context. In this case, context makes the reference clear enough. I would say both sentences are perfectly fine.

In case of ambiguity, one could use a noun instead of a pronoun, as you suggested. Nouns can be made shorter if desired, such as the bin.

Alternatively, especially in somewhat formal genres, one can use the former and the latter, to refer to two things mentioned previously; the latter refers to the last (relevant) thing mentioned, the former to the other (relevant) thing mentioned in case there are only two relevant things to refer to.