added periodic sampling