Adding code to cover test cases, still not working

Covered one test case but now it's failing everything else. Most common
point of failure seems to be line 161. Will look at it after getting
sleep.