Add CycleError
Add tests for checking cycles