added comments and fixed test conditions