Implemented ZLoop class. Minor bugfixes and improvements.