Fixing up test cases. Code clean up.