Clarify code, add features