cleaned up solution to detecting a linked list cycle
fixed an error with the test code in detecting a linked list cycle