Entity: code cleanup