Improved formatting and add more test cases.