adding more comments and checking coditions