Corrected the code. Some copy paste mistake. Tested. Now functioning.