Working version, but without categories.