Updated the code with the working revision