Adding the first function and test cases for Part B