Implemented method [] and has_loop?
Implemented testcases for [] and has_loops? methods