adding the code and also the test file.