Added comments, and assertions for test verification.