Code tidy and id ends