Added regression test and fixed code formatting.