Replaced collections with functional implementation