Cycles removed and some minor bug fixes.