added counting of objects