added test cases and edited formating