Reorganized code. Still need to do more test cases