Refactored erts modules and added some comment.