changed primaryKey to private and added access control