Refactor codes. Add annotations.