added check for public/private and added fields