Cosmetic fixes and added test cases