Implemented loops
Fixed a corner case involving ]