Changed protected fields in Entity to private. 

There is a bug introduced by this change, however; it needs revising.