Code clean up

cleaned up code for entity id and entity type.