Refactored erts modules and added some more comment.