Tested the code with function snippet. Working