Issue 300

All test cases pass.