added main to test the function