Code cleanup for Entities