Updated method with comments.